package com.dynamic.datasource.controller;


import com.dynamic.datasource.dao.entity.Person;
import com.dynamic.datasource.service.PersonService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author author
 * @since 2022-04-01
 */
@RestController
@RequestMapping("/person")
public class PersonController {

    @Resource
    private PersonService personService;

    @GetMapping("/get1")
    public List<Person> getPerson1() {
        return personService.getPerson1();
    }

    @GetMapping("/save1")
    public void save1() {
        personService.save1();
    }

    @GetMapping("/save2")
    public void save2() {
        personService.save2();
    }

    @GetMapping("/get2")
    public List<Person> getPerson2() {
        return personService.getPerson2();
    }

    @GetMapping("/hello")
    public String hello() {
        return "hello";
    }
}
